In many digital logic applications it is desirable to employ a counter which keeps a tally of time elapsed or of the number of occurrences of a particular kind of event. Such a counter may be described in terms of its range, meaning the maximum variation possible in the value stored in the counter, and its resolution, meaning the minimum separation between consecutive values stored in the counter. Ideally, a counter would have a very large range to permit it to operate for a long period of time or over a large number of events, and high resolution to permit detection of changes in the count value between closely spaced times or events.
Counters available in the prior art generally provided a fixed combination of range and resolution. For a fixed number of significant digits in a counter, achieving a large range required sacrificing high resolution, while high resolution could only be obtained at the expense of range. A single counter could not provide both large range and high resolution without using an extremely large number of significant digits, which required more memory, complexity, and cost than desired.
In accordance with the preferred embodiments of the present invention, a counter provides resolution which varies with the value of the stored count. This permits high resolution when the stored value is low, with decreasing resolution as the value of the count increases. Large range may be achieved without sacrificing high resolution at the low end of the range.
Resolution of the count is determined by a prescaler, which provides several selectable resolutions. A selector monitors the value of the most significant digits stored in the count, and selects one of the available resolutions from the prescaler in response to value of thos digits.
In one embodiment, a gray code counter is used to permit asynchronous sampling of the count value. Another embodiment effectively increases the range available at the highest resolution, by splitting the range associated with one combination of the most significant digits. Resetting of the counter can also be made conditional on the value of the stored count.